package com.example.testdemo.teamView;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;

import com.example.testdemo.R;
import com.example.testdemo.general_data.ImgList;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by MrYan on 2018/8/22.
 * 群聊头像页面
 */

public class GroupAvatarActivity extends Activity{

    private GroupAvatarView giv1;
    private GroupAvatarView giv2;
    private GroupAvatarView giv3;
    private GroupAvatarView giv4;
    private GroupAvatarView giv5;
    private GroupAvatarView giv6;
    private GroupAvatarView giv7;
    private GroupAvatarView giv8;
    private GroupAvatarView giv9;

    private List<String> imgString;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_group_avatar);
        giv1 = findViewById(R.id.giv1);
        giv2 = findViewById(R.id.giv2);
        giv3 = findViewById(R.id.giv3);
        giv4 = findViewById(R.id.giv4);
        giv5 = findViewById(R.id.giv5);
        giv6 = findViewById(R.id.giv6);
        giv7 = findViewById(R.id.giv7);
        giv8 = findViewById(R.id.giv8);
        giv9 = findViewById(R.id.giv9);
        initImgUrl();
        setData();
    }

    private void initImgUrl() {
        imgString = new ArrayList<>();
        for (int i = 0; i < 9; i++) {
            imgString.add(ImgList.getNetImage().get(i));
        }
    }

    private void setData() {
        giv1.setImgUrl(imgString.get(0));
        addImgUrl(giv2,2);
        addImgUrl(giv3,3);
        addImgUrl(giv4,4);
        addImgUrl(giv5,5);
        addImgUrl(giv6,6);
        addImgUrl(giv7,7);
        addImgUrl(giv8,8);
        addImgUrl(giv9,9);
    }

    private void addImgUrl(GroupAvatarView giv, int size) {
        List<String> urls = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            urls.add(imgString.get(i));
        }
        giv.setImgUrlList(urls);
    }


}
